<?php
/**
 * @分销
 * @功能说明: 仓储管理
 * @更新说明: 暂无更新
 * @文件名: StorageController.class.php
 * @编码: UTF-8
 * @创建时间: 2016-04-23 17:32
 * @创建人: WENCUN
 */

namespace dg\Controller;


class StorageController extends ApibaseController
{
    /*
     * 分销_仓储商品
     * @date: 2016-04-236 17:30:00
     * @editor: WENCUN
     * */
    public function index(){
        $page = I('get.page')?:1;
        $perpage = 10;
        $list = M('GoodsStorage');
        $url = array();
        if(I('get.goods_title')){
            $list = $list->where('goods_title LIKE "%'.I('get.goods_title').'%"');
            $url['goods_title'] = I('get.goods_title');
        }
        if(I('get.storage')){
            $list = $list->where(array('storage'=>I('get.storage')));
            $url['storage'] = I('get.storage');
        }
        $sObject = clone $list;
        $getData = $list->order(array('update_at'=>'DESC'))->page($page,$perpage)->select();
        $this->assign('page',setPage($sObject->count(),$perpage,$page,'?'.http_build_query($url)));
        $this->assign('getData',$getData);
        $this->display('/storage/index');
    }

    /*
     * 分销_仓库商品详情
     * @date: 2016-04-23 19:03:00
     * @editor: WENCUN
     * */
    public function goodsEdit(){
        $getLevels = M('CateEntity')
            ->where(array('parent_id'=>'0'))->select();
        $this->assign('cate',$getLevels);
        if(I('get.goods_id')){
            $getData = M('GoodsStorage')
                ->where(array('goods_id'=>I('get.goods_id')))->find();
            $this->assign('getData',$getData);
        }
        $this->display('goods/addgoods');
    }
}